<?php

namespace api\controller;

// +----------------------------------------------------------------------
// | 字段设置数据控制层
// +----------------------------------------------------------------------

use common\controller\VerifyController;
use common\exception\LogicException;
use common\service\FieldService;
use think\Request;

class FieldController extends VerifyController
{

    /**
     * @var \common\service\FieldService
     */
    protected $fieldService;

    public function __construct()
    {
        parent::__construct();

        $this->fieldService = new FieldService();
    }

    /**
     * 自动刷新字典配置和缓存
     * @param Request $request
     * @return \think\Response
     * @throws \think\Exception
     */
    public function autoFixFieldConfigAndCache(Request $request)
    {
        try {
            $this->fieldService->autoFixFieldConfigAndCache();
            return json(success_response(''));
        } catch (LogicException $e) {
            throw_strack_exception($e->getMessage(), $e->getCode());
        }
    }
}
